#ifndef VGA_H
#define VGA_H

typedef struct VGACommonState {
	uint8_t *vram_ptr;
	uint32_t vram_size;
	uint8_t sr_index;
	uint8_t sr[8];
	uint8_t gr_index;
	uint8_t gr[16];
	uint8_t ar_index;
	uint8_t ar[21];
	int ar_flip_flop;
	uint8_t cr_index;
	uint8_t cr[256]; /* CRT registers */
	uint8_t msr; /* Misc Output Register */
	uint8_t dac_state;
	uint8_t dac_sub_index;
	uint8_t dac_read_index;
	uint8_t dac_write_index;
	uint8_t dac_cache[3]; /* used when writing */
	uint8_t palette[768];

	uint32_t font_offsets[2];
	uint16_t last_ch_attr[25 * 8];
} VGACommonState;

VGACommonState *vga_init(uint8_t *vga_ram_base);
void vga_draw_text(VGACommonState *s);

#endif
